﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="MP_PositionTypes.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.MP_PositionTypes" %>
<%@ Register src="../Controls/user.ascx" tagname="user" tagprefix="uc2" %>
<asp:Content ID="Content1" runat="server" 
    contentplaceholderid="ContentPlaceHolder1">
    
    <link href="../../Styles/CssClass.css" rel="stylesheet" type="text/css" />
    <title>กำหนดประเภทตำแหน่ง</title>
    
    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">        
            <script type="text/javascript">
                function CollapseSelectTree() {
                    var treeview = $find('<%= RadTreeView1.ClientID %>');
                    var selectedNode = treeview.get_selectedNode();
                    if (selectedNode != null) {
                        selectedNode.collapse();
                    }
                    else {
                        var firstNode = treeview.findNodeByValue("0");
                        firstNode.collapse();
                    }
                }
                function ExpandSelectTree() {
                    var treeview = $find('<%= RadTreeView1.ClientID %>');
                    var selectedNode = treeview.get_selectedNode();
                    if (selectedNode != null) {
                        selectedNode.expand();
                    }
                    else {
                        var firstNode = treeview.findNodeByValue("0");
                        firstNode.expand();
                    }
                }

                function closeRadWindow(sender, args) {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest('CloseWindow');
                }

                function onTextChange(sender) {
                    if (sender.get_value() == "") {
                        sender.set_text("");
                    }
                }
 
            </script>
        
    </telerik:RadCodeBlock>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"  >
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="cmdSearch">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmdExpand">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1"
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmdCollapse">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadTreeView1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel5" />
                    <telerik:AjaxUpdatedControl ControlID="lblHeader" />
                    <telerik:AjaxUpdatedControl ControlID="lblPosTypeSeq" />   
                    <telerik:AjaxUpdatedControl ControlID="Panel4" />                 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>                
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />                    
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="Panel4">
                <UpdatedControls>                                     
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />                    
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
        Height="100%" Width="75px" Transparency="50">
        <table style="height: 100%; width: 100%" border="0">
            <tr>
                <td width="100%" align="center" valign="middle">
                    <img alt="Loading..." 
                        src="../Images/Buttons/loading.gif" 
                        style="border: 0px;" />
                </td>
            </tr>
        </table>
    </telerik:RadAjaxLoadingPanel>
    
    <asp:panel ID="Panel6" runat="server" >
    <table width="1000" cellpadding="0" cellspacing="0" border="0">

        <tr>
            <td width="280" colspan="3">
                <div class="moduleDivSlim1000" style="margin-top: 10px">
                    <div class="moduleDivBottom1000">
                        <asp:Panel ID="PanelFilter" runat="server" ScrollBars="Auto" Width="650px">
                            <table align="center" width="650px">
                                <tr>
                                    <td align="right">
                                        ประเภทบุคลากร : &nbsp;</td>
                                    <td>
                                        <telerik:RadComboBox ID="ddlEmployeeType" runat="server" AllowCustomText="true" 
                                            AutoPostBack="true" CausesValidation="false" DataTextField="Name" 
                                            DataValueField="Sequence" EmptyMessage="... เลือกประเภทบุคลากร ..." 
                                            Filter="Contains" OnClientTextChange="onTextChange" 
                                            onselectedindexchanged="ddlEmployeeType_SelectedIndexChanged" Width="200px">
                                        </telerik:RadComboBox>
                                        <asp:RequiredFieldValidator ID="v7" runat="server" 
                                            ControlToValidate="ddlEmployeeType" ErrorMessage="*">
                                       </asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td width="10" valign="top"> 
                <div class="Background980V3" style="width:270px; height: 380px" >
                        <asp:Panel ID="Panel1" runat="server" Width="280px" ScrollBars="Auto" Visible="False">
                        <table style="border-bottom-style: double; border-color: #008080" width ="100%">
                                <tr>
                                    <td >
                                        &nbsp;&nbsp; ค้นหา :&nbsp;
                                    </td>
                                    <td >
                                        <telerik:RadTextBox ID="txtSearch" Runat="server">
                                        </telerik:RadTextBox>
                                        <asp:ImageButton ID="cmdSearch" runat="server" onclick="cmdSearch_Click" 
                                            ToolTip="กดปุ่มเพื่อเริ่มค้นหาข้อมูล" 
                                            ImageUrl="~/App_UI/Images/Buttons/Magnifier.gif" />
                                        &nbsp;
                                        <!-- <asp:ImageButton ID="cmdExpand" runat="server" 
                                            ImageUrl="../Images/Buttons/ExpandAll.gif" onclick="cmdExpand_Click" 
                                            ToolTip="ขยายทั้งหมด" Height="20px" />
                                        &nbsp;
                                        <asp:ImageButton ID="cmdCollapse" runat="server" 
                                            ImageUrl="../Images/Buttons/CollapseAll.gif" onclick="cmdCollapse_Click" 
                                            ToolTip="ย่อทั้งหมด" Height="20px" /> -->
                                    </td>
                                </tr>
                            </table>
                            
                        </asp:Panel>
                        <asp:Panel ID="Panel2" runat="server" Width="260px" ScrollBars="Auto" CssClass="contentPanelPaddingLeft10px">
                            <telerik:RadTreeView Runat="server" 
                                ID="RadTreeView1" 
                                DataFieldID="Id" 
                                DataFieldParentID="Parent_id" 
                                DataTextField="Name" 
                                DataValueField="Id" 
                                EnableDragAndDrop="True"
                                onnodeclick="RadTreeView1_NodeClick" 
                                CausesValidation="False" 
                                onnodeexpand="RadTreeView1_NodeExpand">
                            </telerik:RadTreeView>
                        </asp:Panel>
                    </div> 
            
            </td>
            <td valign="top">
                <div class="Background980V2 "  style="margin-left: 10px; min-height: 380px; width:680px;padding:10px 10px 10px 10px;">
                    <table align="center" width="690px">
                        <tr>
                            <td align="left" class="tableHeader">
                                <asp:Panel ID="Panel5" runat="server">
                                    <asp:Label ID="lblHeader" runat="server" Font-Bold="True"></asp:Label>
                                    <asp:Label ID="lblPosTypeSeq" runat="server" Visible="false"></asp:Label>
                                </asp:Panel>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Panel ID="Panel4" runat="server" ScrollBars="Auto">
                                    <telerik:RadGrid
                                        ID="RadGrid1"
                                        runat="server"
                                        AllowAutomaticDeletes="True"
                                        AllowFilteringByColumn="True"
                                        AllowMultiRowEdit="True"
                                        AllowMultiRowSelection="True"
                                        AllowPaging="True"
                                        AllowSorting="True"
                                        AutoGenerateColumns="False"
                                        EnableAJAX="True"
                                        EnableAJAXLoadingTemplate="True"
                                        GridLines="None"
                                        OnItemCommand="RadGrid1_ItemCommand"
                                        Skin="Outlook" Width="670px">
                                        <MasterTableView
                                            AllowMultiColumnSorting="True"
                                            CellSpacing="-1"
                                            ClientDataKeyNames="Sequence"
                                            CommandItemDisplay="Top"
                                            DataKeyNames="Sequence"
                                            InsertItemPageIndexAction="ShowItemOnCurrentPage"
                                            NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                                            <CommandItemTemplate>
                                                <table width="100%">
                                                    <tr>
                                                        <td>
                                                            <asp:LinkButton ID="cmdAddNew" runat="server" CausesValidation="False"
                                                                CommandName="InitInsert"
                                                                Visible="<%# !RadGrid1.MasterTableView.IsItemInserted && RadGrid1.EditIndexes.Count <= 0 %>"> <img style="border:0px;vertical-align:middle;" alt="" 
                                        src="../Images/Buttons/AddRecord.gif" /> เพิ่มข้อมูลใหม่</asp:LinkButton>
                                                            &nbsp;&nbsp;
                                                        </td>
                                                        <td align="right"></td>
                                                    </tr>
                                                </table>
                                            </CommandItemTemplate>
                                            <RowIndicatorColumn>
                                                <HeaderStyle Width="20px" />
                                            </RowIndicatorColumn>
                                            <ExpandCollapseColumn>
                                                <HeaderStyle Width="20px" />
                                            </ExpandCollapseColumn>
                                            <Columns>
                                                <telerik:GridEditCommandColumn
                                                    ButtonType="ImageButton"
                                                    EditText="คลิกเพื่อแก้ไขรายการ"
                                                    ItemStyle-Width="15">
                                                    <ItemStyle Width="15px" />
                                                </telerik:GridEditCommandColumn>
                                                <telerik:GridButtonColumn
                                                    ButtonType="ImageButton"
                                                    CommandName="Delete"
                                                    ConfirmDialogType="RadWindow"
                                                    ConfirmText="ลบข้อมูลที่เลือก?"
                                                    ItemStyle-Width="15"
                                                    Text="คลิกเพื่อลบรายการ"
                                                    UniqueName="column1">
                                                    <ItemStyle Width="15px" />
                                                </telerik:GridButtonColumn>
                                                <telerik:GridBoundColumn
                                                    DataField="Sequence"
                                                    DataType="System.Int32"
                                                    Display="False"
                                                    HeaderText="Sequence"
                                                    ReadOnly="True"
                                                    UniqueName="Sequence"
                                                    Visible="False">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn
                                                    DataField="Name"
                                                    FilterControlWidth="100%"
                                                    AutoPostBackOnFilter="true"
                                                    ShowFilterIcon="false"
                                                    HeaderStyle-HorizontalAlign="Center"
                                                    HeaderText="ชื่อประเภทตำแหน่ง"
                                                    UniqueName="Name">
                                                    <HeaderStyle HorizontalAlign="Center" Width="150px" />
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn
                                                    DataField="NameShort"
                                                    FilterControlWidth="100%"
                                                    AutoPostBackOnFilter="true"
                                                    ShowFilterIcon="false"
                                                    HeaderStyle-HorizontalAlign="Center"
                                                    HeaderText="ชื่อย่อ"
                                                    UniqueName="NameShort">
                                                    <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn
                                                    DataField="NameEng"
                                                    FilterControlWidth="100%"
                                                    AutoPostBackOnFilter="true"
                                                    ShowFilterIcon="false"
                                                    HeaderStyle-HorizontalAlign="Center"
                                                    HeaderText="ชื่อภาษาอังกฤษ"
                                                    UniqueName="NameEng">
                                                    <HeaderStyle HorizontalAlign="Center" Width="150px" />
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn
                                                    DataField="NameEngShort"
                                                    FilterControlWidth="100%"
                                                    AutoPostBackOnFilter="true"
                                                    ShowFilterIcon="false"
                                                    HeaderStyle-HorizontalAlign="Center"
                                                    HeaderText="ชื่อย่อภาษาอังกฤษ"
                                                    UniqueName="NameEngShort">
                                                    <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn
                                                    DataField="Remarks"
                                                    FilterControlWidth="100%"
                                                    AutoPostBackOnFilter="true"
                                                    ShowFilterIcon="false"
                                                    HeaderStyle-HorizontalAlign="Center"
                                                    HeaderText="ความหมาย/คำอธิบาย"
                                                    UniqueName="Remarks">
                                                    <HeaderStyle HorizontalAlign="Center" Width="200px" />
                                                </telerik:GridBoundColumn>
                                            </Columns>
                                            <EditFormSettings
                                                EditFormType="WebUserControl"
                                                UserControlName="../UserControls/MP_PositionTypes.ascx">
                                                <EditColumn UniqueName="EditCommandColumn1"></EditColumn>
                                            </EditFormSettings>
                                            <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                        </MasterTableView>
                                        <ClientSettings AllowColumnHide="True"
                                            AllowColumnsReorder="True"
                                            EnableRowHoverStyle="True"
                                            ReorderColumnsOnClient="True">
                                            <Selecting AllowRowSelect="True"
                                                EnableDragToSelectRows="true" />
                                        </ClientSettings>
                                    </telerik:RadGrid>
                                </asp:Panel>
                            </td>
                        </tr>
                    </table>
                </div>
            </td>
        </tr>
    </table>
    </asp:panel></asp:Content>